package org.example.day20240820;

import java.util.ArrayList;
import java.util.List;

public class ListDemo {
    public static void main(String[] args) {
        List<String> stringList = new ArrayList<>();
        stringList.add("zhangsan");
        stringList.add("lisi");
        stringList.add("wangwu");
        System.out.println(stringList);
        stringList.remove("zhangsan");
        System.out.println(stringList);
        stringList.remove(0);
        System.out.println(stringList);
        stringList.contains("zhangsan");//返回true false
        for (String tmp:stringList){
            System.out.println(tmp);
        }
        System.out.println(stringList.get(0));
        System.out.println(stringList.size());

        stringList.set(1,"liudehua");//改
        int index = stringList.indexOf("lisi");
        stringList.set(index,"liudehua");//改李四为刘德华

    }
}
